package servlet;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

@WebServlet(value = "/load",loadOnStartup = 1)
public class LoadServlet extends HttpServlet {
    @Override
    public void init() throws ServletException {
        Properties properties = new Properties();
        ServletContext application = getServletContext();
        InputStream inputStream = application.getResourceAsStream("message.properties");
        try {
            properties.load(inputStream);
            inputStream.close();
            application.setAttribute("ps",properties);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
